<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:xhtml />
<script type="text/javascript">
    $(document).ready(function() {
        // 'DataTablize' the table
        $("#geneTable").dataTable({
            "bPaginate": true,
            "sPaginationType": "full_numbers",
            "bFilter": true,
            "bJQueryUI": true,
            "bAutoWidth": false
        });
    });

   function genePathwayExport(){
        // Set up snp select dialog
        $("#genePathwayExport").dialog({
            width: 400,
            autoOpen: true,
            modal: true
        });
    }
</script>
<div id="makePathwayGeneList" class="content list">
    <h2>Gene to Pathway Results Table</h2>
        <table id="geneTable" cellpadding="0" cellspacing="0" border="0" class="display">
            <thead>
                <tr>
                    <th>Pathway ID</th>
                    <th>Name</th>
                    <logic:iterate id="gene" name="geneSnpForm" property="geneList">
                        <th><bean:write name="gene" property="name" /></th>
                    </logic:iterate>
                </tr>
            </thead>
            <tbody>
                <logic:iterate id="mapEntry" name="geneSnpForm" property="pathwayGeneMap">
                    <tr>
                        <td><bean:write name="mapEntry" property="key.pathwayID" /></td>
                        <td><bean:write name="mapEntry" property="key.name" /></td>
                        <logic:iterate id="gene" name="geneSnpForm" property="geneList">
                            <td>
                                <logic:iterate id="pgene" name="mapEntry" property="value">
                                    <%if(gene.equals(pgene)){%> X <%} %>
                                </logic:iterate>
                            </td>
                        </logic:iterate>

                        
                       
                    </tr>
                </logic:iterate>

            </tbody>
        </table>
        <p></p>
        <html:link href="#" onclick="genePathwayExport()">Export Results to File</html:link>
</div>

<div id="genePathwayExport" class="content input" style="display:none">
    <html:form action="genePathwayExport" enctype="multipart/form-data">
        <dl>
            <dt>Filename:</dt>
            <dd><html:text property="filename"/></dd>
            <dt>Delimiter</dt>
            <dd><html:select property="dlimiter">
                    <html:option value="tab">Tab Delimited</html:option>
                    <html:option value="csv">Comma Separated</html:option>
                </html:select></dd>
            </dl>
            <html:submit value="Download" property="submitType" onclick="$('#genePathwayExport').dialog('close');"/>
            <html:button property="" value="Cancel" onclick="$('#genePathwayExport').dialog('close');"/>
    </html:form>
</div>